import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';

class NativeMessageManager {
  static final NativeMessageManager _instance =
      NativeMessageManager._internal();

  factory NativeMessageManager() => _instance;

  static NativeMessageManager get getInstance => _instance;

  final _methodChannel = const MethodChannel('flutter.im.app');

  MethodChannel get channel => _methodChannel;

  NativeMessageManager._internal() {
    /// 接收原生发送数据
    _methodChannel.setMethodCallHandler((call) async {
      debugPrint("method:=>${call.method} arguments ==> ${call.arguments}");
      // 保存用户信息
      if (call.method == "") {}
    });
  }

  /// 合适的地方通过一下方式发送消息到原生
// channel.invokeMethod(method)
}
